package com.yy.distributed.lock.redis;

import com.yy.distributed.lock.AbstractDLockFactory;
import com.yy.distributed.lock.DLock;
import redis.clients.jedis.JedisPool;

/**
 * Write your description here...
 *
 * @author dinghuan
 * @date 2018/7/19
 */
public class JedisLockFactory extends AbstractDLockFactory {
    private final JedisPool jedisPool;

    public JedisLockFactory(JedisPool jedisPool) {
        this.jedisPool = jedisPool;
    }

    @Override
    public DLock getLock(String name) {
        return new JedisLock(jedisPool, name);
    }

    /**
     * 未实现
     *
     * @return
     * @// TODO: 2018/7/20
     */
    @Override
    public DLock getFairLock(String name) {
        return null;
    }
}
